import { Byte } from '../../api/io/Byte';
import { HashMap } from '../../api/struct/HashMap';


export const enum E_CDPayItem {
	/**id*/
	id,
	/**rmb（单位：分）校验用*/
	rmb,
	/**价格产品id*/
	productid,
	/**钻石数量*/
	gold,
	/**首充双倍奖励*/
	doubleGold,
	/**非双倍奖励*/
	unDoubleGold,
	/**充值积分*/
	payScore,
	/**双倍索引--1.6元双倍2.30元双倍3.98元双倍4.198元双倍5.328元双倍6.648元双倍*/
	doubleIndex,
	/**活动id，配置时间，不配置为永久开放*/
	activityID,
	/**周期性不重置购买礼包需要配置--stepSize>0，服务器会统计对应id的购买次数--购买时发放的奖励id=rewardID+统计值%stepSize*/
	stepSize,
	/**奖励id*/
	rewardID,
	/**限购id//活动、没活动的限购如果没配，好像都给不了奖励--重置的战力配置成每月限购一次*/
	limitID,
	/**需求vip等级*/
	vipLimit,
	/**特权卡标识索引*/
	svrCardIndex,
	/**类型：1.普通充值--2.大小月卡、永久卡、特权卡3.令牌/通行证4.礼包5.超值返利6.rmb礼包7.限时神将8.远航9.每日限购礼包10.每周限购礼包.11.福利礼包12.武将特卖13.iso提审配置14.国庆转盘15.国庆盛典16.新服特卖17.连续充值18.七天战令19.第二日首充20.抽奖令牌1。21.抽奖令牌2。30-50限时神将22.武将特卖第三周23.武将特卖第四周24.第七日随机25.第七日自选26.高级招募有礼。27.史诗招募有礼。28.祈福活动礼包29.双旦活动礼包31-50神将 51.双旦转盘礼包52.司马懿养成53.庞统养成54-80每周礼包81.武将特卖第五周82.武将特卖第六周83.30周卡84.68周卡85.198周卡86.对决战令87-100 七曜宝典101.御魂礼包102.元宵-双层转盘105-107神将升星礼包108.上古战场战令119*/
	type,
	/**1.充值--2.商品--3.任务*/
	payItemType,
	/**商品*/
	goodID,
	/**成就id（大小月卡跟持续时间的领取）任务id*/
	missionID,
	/**渠道id--0通用--1安卓--2ios*/
	channel,
	/**显示价格*/
	showPrice,
	/**显示顺序*/
	order,
	/**图集目录*/
	set,
	/**图标*/
	icon,
	/**商品名称*/
	name,
	/**商品说明*/
	txt,
	/**显示金额字符串读取语言表*/
	priceStr,
	/**优惠比例（百分比）--显示/100+引号*/
	discount,
	/**显示等级*/
	showLv,
	/**显示vip等级需求*/
	showVipLv,
	/**角标显示*/
	cornerMark,
	/**跳转id*/
	jumpID,
	/**gmt分类--0.其他--1.普通充值--2.月卡--3.战令--4.每日特惠--5.超值返利--6.每周礼包--7.商路礼包--8.武将特卖--9.新服特惠--10.第一周赵云养成--11.第二周郭嘉养成--12.第三周卧龙凤雏--13.限时神将--14.圣诞活动--15.春节活动--16.648元周卡--17.连充献礼--18.纵横宝典--19.周卡--20.第二日首充--21.第七日首充--22.祈福活动--23.双层转盘--24.限时礼包*/
	gmtClassify,

	/**枚举数量*/
	EnumCount
}



export class CDPayItem{
	/**id*/
	public id: number;
	/**rmb（单位：分）校验用*/
	public rmb: number;
	/**价格产品id*/
	public productid: number;
	/**钻石数量*/
	public gold: number;
	/**首充双倍奖励*/
	public doubleGold: number;
	/**非双倍奖励*/
	public unDoubleGold: number;
	/**充值积分*/
	public payScore: number;
	/**双倍索引--1.6元双倍2.30元双倍3.98元双倍4.198元双倍5.328元双倍6.648元双倍*/
	public doubleIndex: number;
	/**活动id，配置时间，不配置为永久开放*/
	public activityID: number;
	/**周期性不重置购买礼包需要配置--stepSize>0，服务器会统计对应id的购买次数--购买时发放的奖励id=rewardID+统计值%stepSize*/
	public stepSize: number;
	/**奖励id*/
	public rewardID: number;
	/**限购id//活动、没活动的限购如果没配，好像都给不了奖励--重置的战力配置成每月限购一次*/
	public limitID: number;
	/**需求vip等级*/
	public vipLimit: number;
	/**特权卡标识索引*/
	public svrCardIndex: number;
	/**类型：1.普通充值--2.大小月卡、永久卡、特权卡3.令牌/通行证4.礼包5.超值返利6.rmb礼包7.限时神将8.远航9.每日限购礼包10.每周限购礼包.11.福利礼包12.武将特卖13.iso提审配置14.国庆转盘15.国庆盛典16.新服特卖17.连续充值18.七天战令19.第二日首充20.抽奖令牌1。21.抽奖令牌2。30-50限时神将22.武将特卖第三周23.武将特卖第四周24.第七日随机25.第七日自选26.高级招募有礼。27.史诗招募有礼。28.祈福活动礼包29.双旦活动礼包31-50神将 51.双旦转盘礼包52.司马懿养成53.庞统养成54-80每周礼包81.武将特卖第五周82.武将特卖第六周83.30周卡84.68周卡85.198周卡86.对决战令87-100 七曜宝典101.御魂礼包102.元宵-双层转盘105-107神将升星礼包108.上古战场战令119*/
	public type: number;
	/**1.充值--2.商品--3.任务*/
	public payItemType: number;
	/**商品*/
	public goodID: number;
	/**成就id（大小月卡跟持续时间的领取）任务id*/
	public missionID: number;
	/**渠道id--0通用--1安卓--2ios*/
	public channel: number;
	/**显示价格*/
	public showPrice: number;
	/**显示顺序*/
	public order: number;
	/**图集目录*/
	public set: string;
	/**图标*/
	public icon: string;
	/**商品名称*/
	public name: number;
	/**商品说明*/
	public txt: number;
	/**显示金额字符串读取语言表*/
	public priceStr: number;
	/**优惠比例（百分比）--显示/100+引号*/
	public discount: number;
	/**显示等级*/
	public showLv: number;
	/**显示vip等级需求*/
	public showVipLv: number;
	/**角标显示*/
	public cornerMark: string;
	/**跳转id*/
	public jumpID: number;
	/**gmt分类--0.其他--1.普通充值--2.月卡--3.战令--4.每日特惠--5.超值返利--6.每周礼包--7.商路礼包--8.武将特卖--9.新服特惠--10.第一周赵云养成--11.第二周郭嘉养成--12.第三周卧龙凤雏--13.限时神将--14.圣诞活动--15.春节活动--16.648元周卡--17.连充献礼--18.纵横宝典--19.周卡--20.第二日首充--21.第七日首充--22.祈福活动--23.双层转盘--24.限时礼包*/
	public gmtClassify: number;


	/**获取属性值*/
	public getAttr(idx: number): any {
		switch(idx) { 
			default: return;
			case E_CDPayItem.id: return this.id;
			case E_CDPayItem.rmb: return this.rmb;
			case E_CDPayItem.productid: return this.productid;
			case E_CDPayItem.gold: return this.gold;
			case E_CDPayItem.doubleGold: return this.doubleGold;
			case E_CDPayItem.unDoubleGold: return this.unDoubleGold;
			case E_CDPayItem.payScore: return this.payScore;
			case E_CDPayItem.doubleIndex: return this.doubleIndex;
			case E_CDPayItem.activityID: return this.activityID;
			case E_CDPayItem.stepSize: return this.stepSize;
			case E_CDPayItem.rewardID: return this.rewardID;
			case E_CDPayItem.limitID: return this.limitID;
			case E_CDPayItem.vipLimit: return this.vipLimit;
			case E_CDPayItem.svrCardIndex: return this.svrCardIndex;
			case E_CDPayItem.type: return this.type;
			case E_CDPayItem.payItemType: return this.payItemType;
			case E_CDPayItem.goodID: return this.goodID;
			case E_CDPayItem.missionID: return this.missionID;
			case E_CDPayItem.channel: return this.channel;
			case E_CDPayItem.showPrice: return this.showPrice;
			case E_CDPayItem.order: return this.order;
			case E_CDPayItem.set: return this.set;
			case E_CDPayItem.icon: return this.icon;
			case E_CDPayItem.name: return this.name;
			case E_CDPayItem.txt: return this.txt;
			case E_CDPayItem.priceStr: return this.priceStr;
			case E_CDPayItem.discount: return this.discount;
			case E_CDPayItem.showLv: return this.showLv;
			case E_CDPayItem.showVipLv: return this.showVipLv;
			case E_CDPayItem.cornerMark: return this.cornerMark;
			case E_CDPayItem.jumpID: return this.jumpID;
			case E_CDPayItem.gmtClassify: return this.gmtClassify;
		}
	}



	/**设置属性值*/
	public setAttr(idx: number, v: any): void {
		switch(idx) { 
			default: break;
			case E_CDPayItem.id: this.id = v; break;
			case E_CDPayItem.rmb: this.rmb = v; break;
			case E_CDPayItem.productid: this.productid = v; break;
			case E_CDPayItem.gold: this.gold = v; break;
			case E_CDPayItem.doubleGold: this.doubleGold = v; break;
			case E_CDPayItem.unDoubleGold: this.unDoubleGold = v; break;
			case E_CDPayItem.payScore: this.payScore = v; break;
			case E_CDPayItem.doubleIndex: this.doubleIndex = v; break;
			case E_CDPayItem.activityID: this.activityID = v; break;
			case E_CDPayItem.stepSize: this.stepSize = v; break;
			case E_CDPayItem.rewardID: this.rewardID = v; break;
			case E_CDPayItem.limitID: this.limitID = v; break;
			case E_CDPayItem.vipLimit: this.vipLimit = v; break;
			case E_CDPayItem.svrCardIndex: this.svrCardIndex = v; break;
			case E_CDPayItem.type: this.type = v; break;
			case E_CDPayItem.payItemType: this.payItemType = v; break;
			case E_CDPayItem.goodID: this.goodID = v; break;
			case E_CDPayItem.missionID: this.missionID = v; break;
			case E_CDPayItem.channel: this.channel = v; break;
			case E_CDPayItem.showPrice: this.showPrice = v; break;
			case E_CDPayItem.order: this.order = v; break;
			case E_CDPayItem.set: this.set = v; break;
			case E_CDPayItem.icon: this.icon = v; break;
			case E_CDPayItem.name: this.name = v; break;
			case E_CDPayItem.txt: this.txt = v; break;
			case E_CDPayItem.priceStr: this.priceStr = v; break;
			case E_CDPayItem.discount: this.discount = v; break;
			case E_CDPayItem.showLv: this.showLv = v; break;
			case E_CDPayItem.showVipLv: this.showVipLv = v; break;
			case E_CDPayItem.cornerMark: this.cornerMark = v; break;
			case E_CDPayItem.jumpID: this.jumpID = v; break;
			case E_CDPayItem.gmtClassify: this.gmtClassify = v; break;
		}
	}


	/**数据*/
	public static datas: HashMap<number, CDPayItem> = new HashMap<number, CDPayItem>();



	/**加载数据*/
	public static load(byte: Byte): void{
		const size = byte.readInt32();
		const list : CDPayItem[] = [];
		let i :number;

		for (i = 0; i < size; i++) {
			list[i] = new CDPayItem();
		}
		for (i = 0; i < size; i++) {
			list[i].id = byte.readInt32();
			this.datas.put(list[i].id, list[i]);
		}
		for (i = 0; i < size; i++) {
			list[i].rmb = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].productid = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].gold = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].doubleGold = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].unDoubleGold = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].payScore = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].doubleIndex = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].activityID = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].stepSize = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].rewardID = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].limitID = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].vipLimit = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].svrCardIndex = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].type = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].payItemType = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].goodID = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].missionID = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].channel = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].showPrice = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].order = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].set = byte.readString();
		}
		for (i = 0; i < size; i++) {
			list[i].icon = byte.readString();
		}
		for (i = 0; i < size; i++) {
			list[i].name = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].txt = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].priceStr = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].discount = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].showLv = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].showVipLv = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].cornerMark = byte.readString();
		}
		for (i = 0; i < size; i++) {
			list[i].jumpID = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].gmtClassify = byte.readInt32();
		}
	}


	/** 获取数据*/
	public static getData(id: number): CDPayItem{
		return this.datas ? this.datas.get(id) : null;
	}
}
